<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title><?php echo C('SITE_INFO.name');?></title>
<script type="text/javascript" src="__PUBLIC__/scripts/jquery-1.7.2.min.js"></script>
<link href="__PUBLIC__/Catalog/css/common.css" rel="stylesheet" type="text/css" />

<link href="__PUBLIC__/Catalog/css/sendGoods.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="__PUBLIC__/scripts/ui/redmond/jquery-ui-1.8.6.css">        
<script type="text/javascript" src="__PUBLIC__/scripts/ui/jquery-ui-1.8.6.min.js"></script>
<script src="__PUBLIC__/Static/Uploadify/jquery.uploadify-3.1.min.js"></script>
<link href="__PUBLIC__/Static/Uploadify/uploadify.css" rel="stylesheet">
<link rel="stylesheet" href="__PUBLIC__/js/treeview/jquery.treeview.css" />
<script src="__PUBLIC__/js/treeview/jquery.cookie.js"></script>
<script src="__PUBLIC__/js/treeview/jquery.treeview.js"></script>
<style>
.imagelist{}
.imagelist li{
    display: inline;
    float: left;
	margin-right:10px;
    width: 80px;
	height:60px;
	overflow:hidden;
	position: relative;
	
}
.imagelist li em{
    color: #999999;
    display: block;
    line-height: 18px;
    padding: 8px 0px;
}

.imagelist li span.txt {
	display:none;
    line-height:25px;
	height:25px;
    width: 80px;
	text-align:right;
	position:absolute;
	top:0px;
	right:0px;
}
.uploadify {
    position: absolute;
    margin-bottom: 1em;
    right: 10px;
</style>
<script>
$(function() {
    $( "#datepicker" ).datepicker({dateFormat: "yy-mm-dd"});	
    $( "#sub_tabs" ).tabs();  
});
$(function(){
	$("#browser").treeview({			
		  animated: "medium",
		});	

	$("#image_result").sortable();
	$('.imagelist li').live({
	   mouseenter:
	   function()
	   {
		  $(this).find('.txt').css('display','block');
	   },
	   mouseleave:
	   function()
	   {
		  $(this).find('.txt').css('display','none');
	   }
	});
	$("#upload").uploadify({
		height        : 60,
		swf           : '__PUBLIC__/Static/Uploadify/uploadify.swf',
		uploader      : '<?php echo U("Uploadify/upload");?>',
		width         : 80,
		buttonText	  : '<img width="80" height="60" src="__PUBLIC__/Catalog/images/kaadd.png" />',
		auto		  : true,
		removeCompleted: false,
		onUploadSuccess: function(file, data, response) {
			//$('#progress').hide();
			var result = $.parseJSON(data);
			//错误处理。。。
			if(!data){alert(file.name+'上传失败'); return false;}
			if(result.status == 0){
				alert(file.name+result.message);
				return false;
			}
			//上传成功
			var id = Math.random().toString();
			id = id.replace('.','_'); //生成唯一标示
			var html = '<li class="imageitem" id="'+id+'">';
				html+= '<input type="hidden" name="file[]" value="'+result.file_name+'">'; //隐藏域，是为了把图片地址入库。。
				html+=  '<span class="txt">';
				html+=  '<a title="del" href=javascript:remove("'+result.file_name+'","'+id+'");><img src="__PUBLIC__/Static/Uploadify/remove.png" /></a>';
				html+=  '</span>';
				html+= '<img height="60" width="80" src="'+result.file+'" />';
				html+=  '</li>';
			$('#image_result').append(html);
		},
		/*  onUploadStart: function(){
			$('#progress').empty().append('<img src="__PUBLIC__/images/load.gif">');  //用户等待提示。
			$('#progress').show();
		},*/
		onInit: function (){  
			$("#upload-queue").hide(); //隐藏上传队列                
		}		 
	});
})
function remove(file,id){
	$.getJSON('<?php echo U("removeImg");?>',{file:file},function(data){$('#'+id).remove()})
}

</script>
</head>
<body>
<div class="main">
   <form action="<?php echo U('Mproducts/dpublish');?>" method="post">
	   <div class="title">
	         <div class="title1">
	             <a href="index.html" id="back"> < </a>发布商品
	         </div>
	   </div>
	   <div class="jiaoyi">
	       <div class="ka">
	           <div class="imglist">
	           		<ul class="imagelist" id="image_result">
                    </ul>
	               <span style="display:block;float:right;width:80px;"  class="ka1" id="upload"></span>
	               <!--  <span class="ka1"><img src="__PUBLIC__/Catalog/images/kaimg01.png" /></span>
	                <span class="ka2"><img src="__PUBLIC__/Catalog/images/kaimg02.png" /></span>
	                <span class="kaadd"></span> -->
	           </div>
	       <span class="time">上传图片不建议超过2M</span>
	       </div>
	       <div class="zh">
	           <dl>
	              <dt class="dts">标题</dt>
	              <dd class="dds"><input type="text" name="products_name" value="" placeholder="请输入标题内容(5-15字)" required/></dd>
	           </dl>
	          
	           <dl>
	              <dd>类型:
	            	<input type="radio" name="products_type" value="1" checked="checked"/>一口价&nbsp;&nbsp;
	            	<input type="radio" name="products_type" value="2" />拍卖&nbsp;&nbsp;
	            	<input type="radio" name="products_type" value="3" />公益
	              </dd>
	           </dl>
	           <dl class="zh2">
	              <dd>原价:<input type="text" name="products_oldprice" />元</dd>
	              <dd>一口价:<input type="text" name="products_price"/>元</dd>
	           </dl>
	           <dl class="zh2" id="paimaicontent">
	              <dd>拍卖起步价:<input type="text" name="products_paimai_price" />元</dd>
	              <dd>拍卖截止日期:<input type="text" id="datepicker" name="products_date_avaliable" /></dd>
	           </dl>
	       </div>
	   </div>
	   <div class="select">
	       <div class="select2">
	       			 <dl class="zh2">
			           	<dd>产品分类:
			           		<select name="categories_id" style="border:1px solid #ccc;border-radius:3px;" ><!--  autocomplete="off" -->
									<?php if(is_array($category)): foreach($category as $k=>$vo): ?><option value="<?php echo ($vo["categories_id"]); ?>" <?php if($k == 0): ?>selected="selected"<?php endif; ?> ><?php echo ($vo["categories_name"]); ?></option><?php endforeach; endif; ?>
							</select>
			           	</dd>
			           </dl> 
	                 <dl class="zh2">
	                    <dd>新旧程度:
	            	<select style="border:1px solid #ccc;border-radius:3px;" name="products_weight">
	            		<option value="全新">全新</option>
	                    <option value="九五成新">九五成新</option>
	                    <option value="九成新">九成新</option>
	                    <option value="八五成新">八五成新</option>
	                    <option value="八成新">八成新</option>
	                </select> 
	                    </dd>
	                    <dd>品牌:<input type="text" name="products_model" /></dd>	                    
	                    <dd> 所在区域:
	                     <?php echo W('Shengshi',array('now_city_id'=>$nowCityProvince['code'],'now_prov_id'=>$nowCityProvince['provincecode'],'now_area_id'=>''));?>
	                    </dd>
	                 </dl>
	       </div>
	   </div>
	   <div class="selects">
	       <div class="selects2">
	                 <dl>
	                    <dd><span>联系人:</span><input type="text" name="contact_person" value="<?php if($member["nickname"]): echo ($member["nickname"]); else: echo ($member["name"]); endif; ?>" required/></dd>
	                    <dd><span>电话:</span><input type="text" name="contact_tel" value="<?php echo ($member["tel"]); ?>" required/></dd>
	                    <dd><span>QQ:</span><input type="text" name="contact_qq" /></dd>
	                    <dd><span>微信号:</span><input type="text" name="contact_wechat" /></dd>
	                 </dl>
	                 <dl id="dizhi">
	                    <dt>详细地址:</dt>
	                    <dd><input type="text" name="contact_address" /></dd>
	                 </dl>
	                 <dl id="ms">
	                    <dt>详细描述:</dt>
	                    <dd><textarea placeholder="请根据实际详细描述" name="products_description"></textarea></dd>
	                 </dl>
	                 <dl id="zd">
	                    <dt>选择发布:</dt>
	                    <?php if(is_array($fee)): foreach($fee as $key=>$vo): ?><dd><input type="checkbox" name="<?php if($vo['fee_id'] == 1): ?>up_flag<?php elseif($vo['fee_id'] == 2): ?>jiaji_flag<?php endif; ?>" value="1" /> <?php echo ($vo["fee_name"]); ?>(<?php echo ($vo["active_day"]); ?>天)<strong><?php echo ($vo["fee_money"]); ?>元</strong></dd><?php endforeach; endif; ?>
	                  <!--   <dd><input type="checkbox" name="up_flag" value="1" /> 置顶发布(7天)<strong>15元</strong></dd>
	                    <dd><input type="checkbox" name="jiaji_flag" value="1" /> 加急发布(7天)<strong>5元</strong></dd> -->
	                 </dl>
	       </div>
	   </div>
 		<div class="selects">
			<input type="hidden" name="uid" value="<?php echo ($uid); ?>" />
		   <input type="submit" value="马上发布" />
		</div>
</div>

  </form>
<div class="index-foot">
    <div class="index-foot2">
            <ul>
              <li>
                  <dl>
                      <dd class="index-dds"><a href="<?php echo U('Index/index');?>"><img src="__PUBLIC__/Catalog/images/house.png" /></a></dd>
                      <dd><a href="<?php echo U('Index/index');?>">首页</a></dd>
                  </dl>
              </li>
              <li>
                  <dl>
                      <dd class="index-dds"><a href="<?php echo U('Products/index');?>"><img src="__PUBLIC__/Catalog/images/cate1.png" /></a></dd>
                      <dd><a href="<?php echo U('Products/index');?>">商品</a></dd>
                  </dl>
              </li>
              <li>
                  <dl>
                      <dd><a href="<?php echo U('Mproducts/publish');?>"><img src="__PUBLIC__/Catalog/images/jia.png"style=" width:50px; height:50px;" /></a></dd>
                  </dl>
              </li>
              <li>
                  <dl>
                      <dd class="index-dds"><a href="<?php echo U('Membership/leaveword');?>"><img src="__PUBLIC__/Catalog/images/<?php if($count > 0): ?>message-hot.png<?php else: ?>message.png<?php endif; ?>" /></a></dd>
                      <dd><a href="<?php echo U('Membership/leaveword');?>">信息</a></dd>
                  </dl>
              </li>
              <li>
                  <dl>
                      <dd class="index-dds"><a href="<?php echo U('Membership/index');?>?uid=<?php echo ($uid); ?>"><img src="__PUBLIC__/Catalog/images/men.png" /></a></dd>
                      <dd><a href="<?php echo U('Membership/index');?>?uid=<?php echo ($uid); ?>">我的</a></dd>
                  </dl>
              </li>
            </ul>       
    </div>
</div>
</body>
</html>